﻿#pragma warning(disable: 4996)
#pragma warning(disable: 6031)

#include <stdio.h>

int tax(float distance, int n)
{
	int start_fee = 10;
	int time_fee = 2;
	int time_step = 5;
	int start_dist = 3;
	int dist_fee = 2;
	int dist_empty = 6;
	int dist_fee_empty = 2 * 1.5;

	int ret = n / time_step * time_fee + start_fee;
	distance -= start_dist;
	if (distance > dist_empty) {
		ret += dist_empty * dist_fee;
		distance -= dist_empty;
		ret += distance * dist_fee_empty;
	}
	else if (distance > 0)
	{
		ret += distance * dist_fee;
	}

	return ret;
}

void solve(float d, int a) {
	printf("%d\n", tax(d, a));
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-18.txt", "r", stdin);
	int a;
	float d;
	scanf("%f %d", &d, &a);
	solve(d, a);
	return 0;
}